<template>
  <div>
    <!--  v-loading="loading" element-loading-text="正在查询中请耐心等待1-3分钟" -->
    <el-dialog
      width="90%"
      top="1vh"
      title="查看征信风控大数据"
      @close="closeDialog"
      :visible.sync="dialogVisible"
      :close-on-click-modal="true"
    >
      <h2>{{ name ? name : '' }}征信报告</h2>
      <br />
      <div style="display:flex;justify-content: space-between;width: 100%;margin: 0 auto 10px;">
        <div>报告编号:{{ order_no }}</div>
        <div>报告时间:{{ start_at }}</div>
      </div>
      <el-descriptions title direction="vertical" :column="4" border>
        <el-descriptions-item label="姓名">{{ PA01B?.PA01BQ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="证件类型">{{ PA01B?.PA01BD01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="证件号码">{{ PA01B?.PA01BI01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="查询原因">{{ PA01B?.PA01BD02 || '--' }}</el-descriptions-item>
      </el-descriptions>
      <br />
      <el-descriptions title direction="vertical" :column="1" border>
        <el-descriptions-item label="异议信息提示">信息主体对信用报告内容提出了0笔异议且正在处理中，请浏览时注意阅读相关内容。</el-descriptions-item>
      </el-descriptions>
      <br />
      <h2>一、个人基本信息</h2>
      <br />
      <el-descriptions title="(一)身份信息" direction="vertical" :column="6" border>
        <el-descriptions-item label="性别">{{ personInfo?.PB01AD01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="出身日期">{{ personInfo?.PB01AR01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="婚姻状况">{{ personInfo?.PB020D01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="学历">{{ personInfo?.PB01AD02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="学位">{{ personInfo?.PB01AD03 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="就业状况">{{ personInfo?.PB01AD04 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="国籍">{{ personInfo?.PB01AD05 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="电子邮箱">{{ personInfo?.PB01AQ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="通讯地址" :span="2">{{ personInfo?.PB01AQ02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="户籍地址" :span="2">{{ personInfo?.PB01AQ03 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="手机号码信息" :span="8">
          <el-table :data="houseList1 ? houseList1 : []" border>
            <el-table-column label="编号" width="100">
              <template slot-scope="scope">{{ scope.$index + 1 }}</template>
            </el-table-column>
            <el-table-column prop="PB01BQ01" label="手机号码">
              <template slot-scope="scope">{{ encryptPhoneNumber(scope?.row?.PB01BQ01) || '--' }}</template>
            </el-table-column>
            <el-table-column prop="PB01BR01" label="信息更新日期">
              <template slot-scope="scope">{{ scope?.row?.PB01BR01 || '--' }}</template>
            </el-table-column>
          </el-table>
        </el-descriptions-item>
      </el-descriptions>
      <br />
      <h5>(二)居住信息</h5>
      <br />
      <el-table :data="houseList ? houseList : []" border>
        <el-table-column label="编号" width="100">
          <template slot-scope="scope">{{ scope.$index + 1 }}</template>
        </el-table-column>
        <el-table-column label="住地址" prop="PB030Q01">
          <template slot-scope="scope">{{ scope?.row?.PB030Q01 || '--' }}</template>
        </el-table-column>
        <el-table-column label="住宅电话" prop="PB030Q02">
          <template slot-scope="scope">{{ scope?.row?.PB030Q02 || '--' }}</template>
        </el-table-column>
        <el-table-column label="居住状况" prop="PB030D01">
          <template slot-scope="scope">{{ scope?.row?.PB030D01 || '--' }}</template>
        </el-table-column>
        <el-table-column label="信息更新日期" prop="PB030R01">
          <template slot-scope="scope">{{ scope?.row?.PB030R01 || '--' }}</template>
        </el-table-column>
      </el-table>
      <br />
      <h5>(三)职业信息</h5>
      <br />
      <el-table :data="occupation" border>
        <el-table-column label="编号" width="100">
          <template slot-scope="scope">{{ scope.$index + 1 }}</template>
        </el-table-column>
        <el-table-column label="就业状况" prop="PB040D01" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040D01 || '--' }}</template>
        </el-table-column>
        <el-table-column label="单位性质" prop="PB040D02" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040D02 || '--' }}</template>
        </el-table-column>
        <el-table-column label="单位地址" prop="PB040Q02" min-width="238">
          <template slot-scope="scope">{{ scope?.row?.PB040Q02 || '--' }}</template>
        </el-table-column>
        <el-table-column label="单位电话" prop="PB040Q03" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040Q03 || '--' }}</template>
        </el-table-column>
      </el-table>
      <br />
      <el-table :data="occupation ? occupation : []" border>
        <el-table-column label="编号" width="100">
          <template slot-scope="scope">{{ scope.$index + 1 }}</template>
        </el-table-column>
        <el-table-column label="职业" prop="PB040D04" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040D04 || '--' }}</template>
        </el-table-column>
        <el-table-column label="行业" prop="PB040D03" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040D03 || '--' }}</template>
        </el-table-column>
        <el-table-column label="职务" prop="PB040D05" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040D05 || '--' }}</template>
        </el-table-column>
        <el-table-column label="职称" prop="PB040D06" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040D06 || '--' }}</template>
        </el-table-column>
        <el-table-column label="进入本单位年份" prop="PB040R01" width="200">
          <template slot-scope="scope">{{ scope?.row?.PB040R01 || '--' }}</template>
        </el-table-column>
        <el-table-column label="信息更新日期" prop="PB040R02"></el-table-column>
      </el-table>
      <br />
      <div v-show="allData.POM ? true : false">
        <h5>(四)婚姻信息</h5>
        <br />
        <el-descriptions direction="vertical" :column="6" border>
          <el-descriptions-item label="婚姻状况">{{ personInfo?.PB020D01 || '--' }}</el-descriptions-item>
          <el-descriptions-item label="配偶姓名">{{ spouseList?.PB020Q01 || '--' }}</el-descriptions-item>
          <el-descriptions-item label="配偶证件类型">{{ spouseList?.PB020D02 || '--' }}</el-descriptions-item>
          <el-descriptions-item label="配偶证件号码">{{ spouseList?.PB020I01 || '--' }}</el-descriptions-item>
          <el-descriptions-item label="配偶工作单位">{{ spouseList?.PB020Q02 || '--' }}</el-descriptions-item>
          <el-descriptions-item label="配偶联系电话">{{ spouseList?.PB020Q03 || '--' }}</el-descriptions-item>
        </el-descriptions>
      </div>
      <br />
      <h2>二、信息概要</h2>
      <br />
      <div>
        <div
          style="text-align:left;width:100%;font-size:16px;color: #303133;font-weight: 700;"
        >（一）信贷交易信息提示</div>
        <br />
        <el-table :data="PC02AH" border>
          <el-table-column label="业务种类">
            <template slot-scope="scope">
              <span>{{ scope?.row?.PC02AD02 || '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="业务类型" prop="PC02AD01">
            <template slot-scope="scope">
              <span>{{ scope?.row?.PC02AD01 || '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="账户数" prop="PC02AS03">
            <template slot-scope="scope">
              <span>{{ scope?.row?.PC02AS03 || '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="首笔业务发放月份" prop="PC02AR01">
            <template slot-scope="scope">
              <span>{{ scope?.row?.PC02AR01 || '--' }}</span>
            </template>
          </el-table-column>
        </el-table>
        <div class="account" style="display:flex;border: 1px solid #EBEEF5;">
          <p class="text-center" style="flex:2;font-size: 15px;border-left: 1px solid #EBEEF5;">合计</p>
          <p
            class="text-center"
            style="flex:1;font-size: 15px;border-left: 1px solid #EBEEF5;"
          >{{ allData?.PCO?.PC02?.PC02A?.PC02AS01 || '--' }}</p>
          <p class="text-center" style="flex:1;font-size: 15px;border-left: 1px solid #EBEEF5;">--</p>
        </div>
      </div>
      <br />
      <el-descriptions title="(二)信贷交易授信及负债信息概要" direction="vertical" :column="5" border>
        <el-descriptions-item :span="5">非循环贷账户信息汇总</el-descriptions-item>
        <el-descriptions-item label="管理机构数 ">{{ allData?.PCO?.PC02?.PC02E?.PC02ES01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="账户数 ">{{ allData?.PCO?.PC02?.PC02E?.PC02ES02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="授信总额 ">{{ allData?.PCO?.PC02?.PC02E?.PC02EJ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="余额 ">{{ allData?.PCO?.PC02?.PC02E?.PC02EJ02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="最近6个月平均应还款">{{ allData?.PCO?.PC02?.PC02E?.PC02EJ03 || '--' }}</el-descriptions-item>
        <el-descriptions-item :span="5">循环额度下分账户信息汇总</el-descriptions-item>
        <el-descriptions-item label="管理机构数 ">{{ allData?.PCO?.PC02?.PC02F?.PC02FS01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="账户数 ">{{ allData?.PCO?.PC02?.PC02F?.PC02FS02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="授信总额 ">{{ allData?.PCO?.PC02?.PC02F?.PC02FJ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="余额 ">{{ allData?.PCO?.PC02?.PC02F?.PC02FJ02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="最近6个月平均应还款">{{ allData?.PCO?.PC02?.PC02F?.PC02FJ03 || '--' }}</el-descriptions-item>
        <el-descriptions-item :span="5">循环账户信息汇总</el-descriptions-item>
        <el-descriptions-item label="管理机构数 ">{{ allData?.PCO?.PC02?.PC02G?.PC02GS01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="账户数 ">{{ allData?.PCO?.PC02?.PC02G?.PC02GS02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="授信总额 ">{{ allData?.PCO?.PC02?.PC02G?.PC02GJ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="余额 ">{{ allData?.PCO?.PC02?.PC02G?.PC02GJ02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="最近6个月平均应还款">{{ allData?.PCO?.PC02?.PC02G?.PC02GJ03 || '--' }}</el-descriptions-item>
        <el-descriptions-item :span="5">贷记卡账户信息汇总</el-descriptions-item>
        <el-descriptions-item label="发卡机构数 ">{{ allData?.PCO?.PC02?.PC02H?.PC02HS01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="账户数 ">{{ allData?.PCO?.PC02?.PC02H?.PC02HS02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="授信总额 ">{{ allData?.PCO?.PC02?.PC02H?.PC02HJ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="单家机构最高授信额">{{ allData?.PCO?.PC02?.PC02H?.PC02HJ02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="单价机构最低授信额 ">{{ allData?.PCO?.PC02?.PC02H?.PC02HJ03 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="已用额度 ">{{ allData?.PCO?.PC02?.PC02H?.PC02HJ04 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="最近6个月平均使用额度 ">{{ allData?.PCO?.PC02?.PC02H?.PC02HJ05 || '--' }}</el-descriptions-item>
      </el-descriptions>
      <br />
      <el-descriptions title="(三)查询记录概要" direction="vertical" :column="3" border>
        <el-descriptions-item :span="3">上一次查询记录</el-descriptions-item>
        <el-descriptions-item label>{{ allData?.PQO?.PC05?.PC05A?.PC05AR01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label>{{ allData?.PQO?.PC05?.PC05A?.PC05AQ01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label>{{ allData?.PQO?.PC05?.PC05A?.PC05AD01 || '--' }}</el-descriptions-item>
      </el-descriptions>
      <br />
      <el-descriptions direction="vertical" :column="8" border>
        <el-descriptions-item :span="2">最近1个月内的查询机构数</el-descriptions-item>
        <el-descriptions-item :span="3">最近1个月内的查询次数</el-descriptions-item>
        <el-descriptions-item :span="3">最近2年内的查询次数</el-descriptions-item>
        <el-descriptions-item label="贷款审批">{{ allData?.PQO?.PC05?.PC05B?.PC05BS01 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="信用卡审批">{{ allData?.PQO?.PC05?.PC05B?.PC05BS02 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="贷款审批">{{ allData?.PQO?.PC05?.PC05B?.PC05BS03 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="信用卡审批">{{ allData?.PQO?.PC05?.PC05B?.PC05BS04 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="本人查询">{{ allData?.PQO?.PC05?.PC05B?.PC05BS05 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="贷后管理">{{ allData?.PQO?.PC05?.PC05B?.PC05BS06 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="担保资格审查">{{ allData?.PQO?.PC05?.PC05B?.PC05BS07 || '--' }}</el-descriptions-item>
        <el-descriptions-item label="特约商户实名审查">{{ allData?.PQO?.PC05?.PC05B?.PC05BS08 || '--' }}</el-descriptions-item>
      </el-descriptions>
      <br />
      <h2>三、信贷交易信息明细</h2>
      <br />
      <h5>（一）借贷账户信息</h5>
      <br />
      <div v-for="(item, index) in account1" :key="index" style="margin-bottom: 45px;">
        <br />
        <div>
          <div class="account" style="text-align:center;width:100%;font-size:20px">账户{{ index + 1 }}</div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;font-size: 15px;">管理机构</p>
            <p class="text-center" style="width:33%;font-size: 15px;">账户标识</p>
            <p class="text-center" style="width:33%;font-size: 15px;">开立日期</p>
            <p class="text-center" style="width:33%;font-size: 15px;">到期日期</p>
            <p class="text-center" style="width:33%;font-size: 15px;">借款金额</p>
            <p class="text-center" style="width:33%;font-size: 15px;">账户币种</p>
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AI02 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AI03 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AR01 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AR02 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AJ01 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AD04 || '--' }}</p>
          </div>
        </div>
        <div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;font-size: 15px;">业务种类</p>
            <p class="text-center" style="width:33%;font-size: 15px;">担保方式</p>
            <p class="text-center" style="width:33%;font-size: 15px;">还款期数</p>
            <p class="text-center" style="width:33%;font-size: 15px;">还款频率</p>
            <p class="text-center" style="width:33%;font-size: 15px;">还款方式</p>
            <p class="text-center" style="width:33%;font-size: 15px;">共同借款标志</p>
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AD03 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AD07 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AS01 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AD06 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AD05 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01A?.PD01AD09 || '--' }}</p>
          </div>
        </div>
        <div v-if="item.PD01C && item.PD01C !== '--' && item.PD01C.PD01CD01 != '结清'">
          <div
            class="account"
            style="text-align:center;width:100%;font-size:18px"
          >{{ item?.PD01C?.PD01CR02 || '--' }}截至</div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;font-size: 15px;">账户状态</p>
            <p class="text-center" style="width:33%;font-size: 15px;">五级分类</p>
            <p class="text-center" style="width:33%;font-size: 15px;">余额</p>
            <p class="text-center" style="width:33%;font-size: 15px;">剩余还款期数</p>
            <p class="text-center" style="width:33%;font-size: 15px;">本月应还款</p>
            <p class="text-center" style="width:33%;font-size: 15px;">应还款日</p>
            <p class="text-center" style="width:33%;font-size: 15px;">本月实还款</p>
            <p class="text-center" style="width:33%;font-size: 15px;">近一次还款日期</p>
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;background-color:#E43C3A;color:#fff">
              {{ item?.PD01C?.PD01CD01 ||
              '--'
              }}
            </p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CD02 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CJ01 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CS01 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CJ04 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CR02 || '--' }}</p>
            <p class="text-center" style="width:33%;background-color:#97F0A7;color:#000">
              {{ item?.PD01C?.PD01CJ05 ||
              '--'
              }}
            </p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CR03 || '--' }}</p>
          </div>
        </div>
        <div v-if="item.PD01C && item.PD01C !== '--' && item.PD01C.PD01CD01 != '结清'">
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;font-size: 15px;">当前逾期期数</p>
            <p class="text-center" style="width:33%;font-size: 15px;">当前逾期总额</p>
            <p class="text-center" style="width:33%;font-size: 15px;">逾期31-60天未还本金</p>
            <p class="text-center" style="width:33%;font-size: 15px;">逾期61-90天未还本金</p>
            <p class="text-center" style="width:33%;font-size: 15px;">逾期91-180天未还本金</p>
            <p class="text-center" style="width:33%;font-size: 15px;">逾期180天以上未还本金</p>
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;background-color:#E43C3A;color:#fff">
              {{ item?.PD01C?.PD01CS02 ||
              '--'
              }}
            </p>
            <p class="text-center" style="width:33%;background-color:#E43C3A;color:#fff">
              {{ item?.PD01C?.PD01CJ06 ||
              '--'
              }}
            </p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CJ07 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CJ08 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CJ09 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01C?.PD01CJ10 || '--' }}</p>
          </div>
        </div>
        <div v-if="item.PD01B.PD01BD01 == '结清'">
          <div
            class="account"
            style="text-align:center;width:100%;font-size:18px"
          >{{ item?.PD01B?.PD01BR01 || '--' }}截至</div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:50%;font-size: 15px;">账户状态</p>
            <p class="text-center" style="width:50%;font-size: 15px;">账户关闭日期</p>
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:50%;background-color:#E43C3A;color:#fff">
              {{ item?.PD01B?.PD01BD01 ||
              '--'
              }}
            </p>
            <p class="text-center" style="width:50%">{{ item?.PD01B?.PD01BR01 || '--' }}</p>
          </div>
        </div>
        <div v-else-if="item?.PD01B?.PD01BR02">
          <div class="account" style="text-align:center;width:100%;font-size:18px">
            {{ item?.PD01B?.PD01BR02
            || '--' }}以后的最新还款记录
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%;font-size: 15px;">五级分类</p>
            <p class="text-center" style="width:33%;font-size: 15px;">余额</p>
            <p class="text-center" style="width:33%;font-size: 15px;">还款日期</p>
            <p class="text-center" style="width:33%;font-size: 15px;">还款金额</p>
            <p class="text-center" style="width:33%;font-size: 15px;">当前还款状态</p>
          </div>
          <div class="account" style="display:flex;">
            <p class="text-center" style="width:33%">{{ item?.PD01B?.PD01BD03 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01B?.PD01BJ01 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01B?.PD01BR02 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01B?.PD01BJ02 || '--' }}</p>
            <p class="text-center" style="width:33%">{{ item?.PD01B?.PD01BD04 || '--' }}</p>
          </div>
        </div>
        <div v-show="item.PD01EH ? true : false">
          <div
            class="account"
            style="text-align:center;width:100%;font-size:18px"
          >{{ item?.PD01E?.PD01ER01 || '--' }}至{{ item?.PD01E?.PD01ER02 || '--' }}的还款记录</div>
          <br />
          <div style="color:red">
            *还款状态代码表：N-"正常，准贷记卡透支后还清" B-"呆账,长期不还款，具体逾期天数未知。"; C-"正常销户"; G-"结束";
            <br />1-"透支1-30天"; 2-"透支 31-60 天"; 3-"透支 61-90 天"; 4-"透支 91-120 天"; 5-"透支 121-150 天"; 6-"透支 151-180 天";
            7-"透支 180
            天以上";
          </div>
          <div style="overflow: scroll;white-space:nowrap;margin: 0 auto;">
            <table border="1" cellspacing="0">
              <tr>
                <td
                  style="padding: 10px;"
                  v-for="(item1, i) in item.PD01EH"
                  :key="i"
                >{{ item1?.PD01ER03 || '--' }}</td>
              </tr>
              <tr>
                <td
                  style="padding: 10px;"
                  v-for="(item1, i) in item.PD01EH"
                  :key="i"
                >{{ item1?.PD01ED01 || '--' }}</td>
              </tr>
              <tr>
                <td
                  style="padding: 10px;"
                  v-for="(item1, i) in item.PD01EH"
                  :key="i"
                >{{ item1?.PD01EJ01 || '--' }}</td>
              </tr>
            </table>
          </div>
        </div>
        <div>
          <div
            v-show="item.PD01F && item.PD01F !== '--' ? true : false"
            class="account"
            style="display:flex;"
          >
            <p class="text-center" style="width:20%;font-size: 15px;">特殊交易类型</p>
            <p class="text-center" style="width:20%;font-size: 15px;">发生日期</p>
            <p class="text-center" style="width:20%;font-size: 15px;">变更月数</p>
            <p class="text-center" style="width:20%;font-size: 15px;">发生金额</p>
            <p class="text-center" style="width:20%;font-size: 15px;">明细记录</p>
          </div>
          <div
            v-show="item.PD01F && item.PD01F !== '--' ? true : false"
            class="account"
            style="display:flex;"
          >
            <p class="text-center" style="width:20%">{{ item?.PD01F?.PD01FD01 || '--' }}</p>
            <p class="text-center" style="width:20%">{{ item?.PD01F?.PD01FR01 || '--' }}</p>
            <p class="text-center" style="width:20%">{{ item?.PD01F?.PD01FS02 || '--' }}</p>
            <p class="text-center" style="width:20%">{{ item?.PD01F?.PD01FJ01 || '--' }}</p>
            <p class="text-center" style="width:20%">{{ item?.PD01F?.PD01FQ01 || '--' }}</p>
          </div>
        </div>
      </div>
      <br />
      <div>
        <br />
        <h5>（二）授信协议信息</h5>
        <br />
        <div class="sx-box" v-for="(item, index) in PACList" :key="index">
          <el-descriptions
            :title="'授信协议' + (index + 1)"
            direction="vertical"
            :column="5"
            border
            :labelStyle="{ color: '#333', textAlign: 'center' }"
            :contentStyle="{ textAlign: 'center' }"
          >
            <el-descriptions-item label="管理机构类型">{{ item?.PD02A?.PD02AD01 || '' }}</el-descriptions-item>
            <el-descriptions-item label="授信协议标识">{{ item?.PD02A?.PD02AI03 || '' }}</el-descriptions-item>
            <el-descriptions-item label="生效日期">{{ item?.PD02A?.PD02AR01 || '' }}</el-descriptions-item>
            <el-descriptions-item label="到期日期">{{ item?.PD02A?.PD02AR02 || '' }}</el-descriptions-item>
            <el-descriptions-item label="授信额度用途">{{ item?.PD02A?.PD02AD02 || '' }}</el-descriptions-item>
            <el-descriptions-item label="授信额度">{{ item?.PD02A?.PD02AJ01 || '' }}</el-descriptions-item>
            <el-descriptions-item label="授信限额">{{ item?.PD02A?.PD02AJ03 || '' }}</el-descriptions-item>
            <el-descriptions-item label="授信限额编号">{{ item?.PD02A?.PD02AI04 || '' }}</el-descriptions-item>
            <el-descriptions-item label="已用额度">{{ item?.PD02A?.PD02AJ04 || '' }}</el-descriptions-item>
            <el-descriptions-item label="币种">{{ item?.PD02A?.PD02AD03 || '' }}</el-descriptions-item>
          </el-descriptions>
        </div>
      </div>
      <br />
      <h2>四、非信贷交易信息明细</h2>
      <br />
      <div class="account ggmx-title">后付费记录</div>
      <el-table :data="PE01A" border>
        <el-table-column label="机构名称" prop="PE01AQ01"></el-table-column>
        <el-table-column label="业务类型" prop="PE01AD02"></el-table-column>
        <el-table-column label="业务开通日期" prop="PE01AR01"></el-table-column>
        <el-table-column label="当前缴费状态" prop="PE01AD03"></el-table-column>
        <el-table-column label="当前欠费金额" prop="PE01AJ01"></el-table-column>
        <el-table-column label="记账年月" prop="PE01AR02"></el-table-column>
      </el-table>
      <br />
      <h2>五、公共信息明细</h2>
      <br />
      <div class="ggmx-box">
        <div class="account ggmx-title">住房公积金参缴记录</div>
        <el-table :data="PF05A" border>
          <el-table-column label="参缴地" prop="PF05AQ01"></el-table-column>
          <el-table-column label="参缴日期" prop="PF05AR01"></el-table-column>
          <el-table-column label="缴费状态" prop="PF05AD01"></el-table-column>
          <el-table-column label="初缴月份" prop="PF05AR02"></el-table-column>
          <el-table-column label="缴至月份" prop="PF05AR03"></el-table-column>
          <el-table-column label="单位缴存比例" prop="PF05AQ02"></el-table-column>
          <el-table-column label="个人缴存比例" prop="PF05AQ03"></el-table-column>
          <el-table-column label="月缴存额" prop="PF05AJ01"></el-table-column>
          <el-table-column label="缴费单位" prop="PF05AQ04"></el-table-column>
          <el-table-column label="信息更新日期" prop="PF05AR04"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">欠税记录</div>
        <el-table :data="PF01A" border>
          <el-table-column label="主管税务机关" prop="PF01AQ01"></el-table-column>
          <el-table-column label="欠税总额" prop="PF01AJ01"></el-table-column>
          <el-table-column label="欠税统计日期" prop="PF01AR01"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">民事判决记录</div>
        <el-table :data="PF02A" border>
          <el-table-column label="立案法院" prop="PF02AQ01"></el-table-column>
          <el-table-column label="案由" prop="PF02AQ02"></el-table-column>
          <el-table-column label="立案日期" prop="PF02AR01"></el-table-column>
          <el-table-column label="结案方式" prop="PF02AD01"></el-table-column>
          <el-table-column label="判决/调解结果" prop="PF02AQ03"></el-table-column>
          <el-table-column label="判决/调解生效日期" prop="PF02AR02"></el-table-column>
          <el-table-column label="诉讼标的" prop="PF02AQ04"></el-table-column>
          <el-table-column label="诉讼标的金额" prop="PF02AJ01"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">强制执行记录</div>
        <el-table :data="PF03A" border>
          <el-table-column label="执行法院" prop="PF03AQ01"></el-table-column>
          <el-table-column label="执行案由" prop="PF03AQ02"></el-table-column>
          <el-table-column label="立案日期" prop="PF03AR01"></el-table-column>
          <el-table-column label="结案方式" prop="PF03AD01"></el-table-column>
          <el-table-column label="案件状态" prop="PF03AQ03"></el-table-column>
          <el-table-column label="结案日期" prop="PF03AR02"></el-table-column>
          <el-table-column label="申请执行标的" prop="PF03AQ04"></el-table-column>
          <el-table-column label="申请执行标的金额" prop="PF03AJ01"></el-table-column>
          <el-table-column label="已执行标的" prop="PF03AQ05"></el-table-column>
          <el-table-column label="已执行标的金额" prop="PF03AJ02"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">行政处罚记录</div>
        <el-table :data="PF04A" border>
          <el-table-column label="处罚机构" prop="PF04AQ01"></el-table-column>
          <el-table-column label="处罚内容" prop="PF04AQ02"></el-table-column>
          <el-table-column label="处罚金额" prop="PF04AJ01"></el-table-column>
          <el-table-column label="处罚生效日期" prop="PF04AR01"></el-table-column>
          <el-table-column label="处罚截止日期" prop="PF04AR02"></el-table-column>
          <el-table-column label="行政复议结果" prop="PF04AQ03"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">低保救助记录</div>
        <el-table :data="PF06A" border>
          <el-table-column label="人员类别" prop="PF06AD01"></el-table-column>
          <el-table-column label="所在地" prop="PF06AQ01"></el-table-column>
          <el-table-column label="工作单位" prop="PF06AQ02"></el-table-column>
          <el-table-column label="家庭月收入" prop="PF06AQ03"></el-table-column>
          <el-table-column label="申请日期" prop="PF06AR01"></el-table-column>
          <el-table-column label="批准日期" prop="PF06AR02"></el-table-column>
          <el-table-column label="信息更新日期" prop="PF06AR03"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">执业资格记录</div>
        <el-table :data="PF07A" border>
          <el-table-column label="执业资格名称" prop="PF07AQ01"></el-table-column>
          <el-table-column label="颁发机构" prop="PF07AQ02"></el-table-column>
          <el-table-column label="等级" prop="PF07AD01"></el-table-column>
          <el-table-column label="机构所在地" prop="PF07AD02"></el-table-column>
          <el-table-column label="获得年月" prop="PF07AR01"></el-table-column>
          <el-table-column label="到期年月" prop="PF06AR02"></el-table-column>
          <el-table-column label="吊销年月" prop="PF07AR03"></el-table-column>
        </el-table>
      </div>
      <div class="ggmx-box">
        <div class="account ggmx-title">行政奖励记录</div>
        <el-table :data="PF08A" border>
          <el-table-column label="奖励机构" prop="PF08AQ01"></el-table-column>
          <el-table-column label="奖励内容" prop="PF08AQ02"></el-table-column>
          <el-table-column label="生效年月" prop="PF08AR01"></el-table-column>
          <el-table-column label="截止年月" prop="PF08AR02"></el-table-column>
        </el-table>
      </div>
      <br />
      <h2>六、查询记录</h2>
      <br />
      <el-table :data="PH01" border>
        <el-table-column label="编号">
          <template slot-scope="scope">{{ scope.$index + 1 }}</template>
        </el-table-column>
        <el-table-column label="查询日期" prop="PH010R01"></el-table-column>
        <el-table-column label="机构类型" prop="PH010D01"></el-table-column>
        <el-table-column label="查询机构" prop="PH010Q02"></el-table-column>
        <el-table-column label="查询原因" prop="PH010Q03"></el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import { getRiskData, getCreditNewData } from '@/api/order'
import { getPA01BD01, getPA01BD02, getPB01AD01, getPB01AD02, getPB01AD03, getPB01AD04, getPB020D01, getPB030D01, getPB040D02, getPC02AD01, getPC02AD02, getPD02AD01, getPD02AD02 } from '../../../utils/credit'
export default {
  // props: ['editItem'],
  props: {
    orderId: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      tempList: [],
      allData: {},
      name: '',
      idcard: '',
      start_at: '',
      order_no: '',
      houseList: [], // 居住信息
      houseList1: [], // 手机号变更信息
      occupation: [], //职业信息
      spouseList: {}, //配偶身份信息
      PMM: {}, //
      PRM: {}, // 居住信息
      account1: [], // 非循环贷账户
      account2: [], // 循环额度下分账户
      account3: [], // 循环贷账户
      account4: [], // 贷记卡账户
      list1: [], // 最新还款
      loading: true,
      is_success: 0,
      obj: {},
      dialogVisible: false,
      testData: [],
      PACList: [],
      // new
      PC02AH: [],
      PA01B: {},
      PB03: [],
      personInfo: {}, //身份信息
      PH01: [],
      PE01A: [], //非信贷交易信息明细-后付费记录
      PF05A: [], //公共信息-公积金缴纳记录
      PF01A: [], //公共信息-欠税记录
      PF02A: [], //公共信息-民事判决记录
      PF03A: [], //公共信息-强制执行记录
      PF04A: [], //公共信息-强制执行记录
      PF06A: [], //公共信息-低保救助记录
      PF07A: [], //公共信息-执业资格记录
      PF08A: [], //公共信息-行政奖励记录
    }
  },
  methods: {
    encryptPhoneNumber(phone) {
      const reg = /(\d{3})\d{4}(\d{4})/
      return String(phone).replace(reg, '$1****$2')
    },
    closeDialog() {
      this.dialogVisible = false
    },
    getData() {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)',
      })
      getCreditNewData(this.orderId)
        .then((res) => {
          this.houseList = [] // 手机号变更信息
          this.houseList1 = [] // 居住信息
          this.PACList = []
          this.PRM = {} // 居住信息
          this.account1 = [] // 非循环贷账户
          this.account2 = [] // 循环额度下分账户
          this.account3 = [] // 循环贷账户
          this.account4 = [] // 贷记卡账户
          this.list1 = [] // 最新还款
          // new
          this.$emit('setIsSuccess', res.is_success)
          if (res.is_success == 1) {
            this.name = res.cert_name
            this.order_no = res.order_no
            this.start_at = res.start_at
            this.idcard = res.cert_no
            this.allData = this.creditDataHandler(res.result.data.json)
            console.log('this.account1', this.account1)

            if (this.allData.PRM.PB03) {
              let tempArr = Array.isArray(this.allData.PRM.PB03) ? this.allData.PRM.PB03 : [this.allData.PRM.PB03]
              this.houseList = tempArr.map((item) => {
                item.PB030D01 = item.PB030D01 ? getPB030D01(item.PB030D01) : '--'
                return item
              })
            } else this.houseList = []
            if (this.allData.POM.PB04) {
              let tempArr = Array.isArray(this.allData.POM.PB04) ? this.allData.POM.PB04 : [this.allData.POM.PB04]
              this.occupation = tempArr.map((item) => {
                item.PB040D02 = item.PB040D02 ? getPB040D02(item.PB040D02) : '--'
                return item
              })
            } else this.occupation = []
            this.PA01B = this.allData?.PRH?.PA01?.PA01B ? this.allData?.PRH?.PA01?.PA01B : {}
            if (this.PA01B.PA01BD01) {
              this.PA01B.PA01BD01 = getPA01BD01(this.PA01B.PA01BD01)
            }
            if (this.PA01B.PA01BD02) {
              this.PA01B.PA01BD02 = getPA01BD02(this.PA01B.PA01BD02)
            }
            let personInfoTemp = this.allData.PIM?.PB01?.PB01A ? this.allData.PIM?.PB01?.PB01A : {}
            if (personInfoTemp['PB01AD01']) personInfoTemp['PB01AD01'] = getPB01AD01(personInfoTemp['PB01AD01'])
            if (personInfoTemp['PB01AD02']) personInfoTemp['PB01AD02'] = getPB01AD02(personInfoTemp['PB01AD02'])
            if (personInfoTemp['PB01AD03']) personInfoTemp['PB01AD03'] = getPB01AD03(personInfoTemp['PB01AD03'])
            if (personInfoTemp['PB01AD04']) personInfoTemp['PB01AD04'] = getPB01AD04(personInfoTemp['PB01AD04'])
            this.personInfo = { ...personInfoTemp, PB020D01: getPB020D01(this.allData.PMM?.PB02?.PB020D01) }
            this.spouseList = this.allData.PMM.PB02 ? this.allData.PMM.PB02 : {}

            if (this.allData.PIM?.PB01?.PB01B?.PB01BH && Array.isArray(this.allData.PIM.PB01.PB01B.PB01BH)) {
              this.houseList1 = this.allData.PIM.PB01.PB01B.PB01BH
            } else {
              this.houseList1 = [this.allData.PIM.PB01.PB01B.PB01BH]
            }

            if (this.allData.PDA.PD01) {
              if (Array.isArray(this.allData.PDA.PD01)) {
                this.account1.push(...this.allData.PDA.PD01)
              } else {
                this.account1.push(...[this.allData.PDA.PD01])
              }
            }
            if (this.allData.PCA && this.allData.PCA !== '--') {
              if (!this.allData.PCA.PD02 || this.allData.PCA.PD02 == '--') this.PACList = []
              else if (Array.isArray(this.allData.PCA.PD02)) {
                this.allData.PCA.PD02.forEach((x) => {
                  if (x.PD02A.PD02AD01) {
                    x.PD02A.PD02AD01 = getPD02AD01(x.PD02A.PD02AD01)
                  }
                  if (x.PD02A.PD02AD02) {
                    x.PD02A.PD02AD02 = getPD02AD02(x.PD02A.PD02AD02)
                  }
                })
                this.PACList.push(...this.allData.PCA.PD02)
              } else {
                if (this.allData.PCA.PD02.PD02A.PD02AD01) {
                  this.allData.PCA.PD02.PD02A.PD02AD01 = getPD02AD01(this.allData.PCA.PD02.PD02A.PD02AD01)
                  this.allData.PCA.PD02.PD02A.PD02AD02 = getPD02AD02(this.allData.PCA.PD02.PD02A.PD02AD02)
                }
                this.PACList.push(...[this.allData.PCA.PD02])
              }
            }
            if (this.allData.PCO?.PC02?.PC02A?.PC02AH) {
              let tempArr = Array.isArray(this.allData.PCO?.PC02?.PC02A?.PC02AH) ? this.allData.PCO?.PC02?.PC02A?.PC02AH : [this.allData.PCO?.PC02?.PC02A?.PC02AH]
              this.PC02AH = tempArr.map((item) => {
                item.PC02AD02 = item.PC02AD02 ? getPC02AD02(item.PC02AD02) : '--'
                item.PC02AD01 = item.PC02AD01 ? getPC02AD01(item.PC02AD01) : '--'
                return item
              })
            } else this.PC02AH = []
            if (this.allData.POQ?.PH01) {
              let tempArr = Array.isArray(this.allData.POQ?.PH01) ? this.allData.POQ?.PH01 : [this.allData.POQ?.PH01]
              this.PH01 = tempArr.map((item) => {
                item.PH010Q03 = item.PH010Q03 ? getPA01BD02(item.PH010Q03) : '--'
                return item
              })
            } else this.PH01 = []
            if (this.allData.PHF?.PF05?.PF05A) {
              let tempArr = Array.isArray(this.allData.PHF?.PF05?.PF05A) ? this.allData.PHF?.PF05?.PF05A : [this.allData.PHF?.PF05?.PF05A]
              let statusDic = {
                1: '缴存',
                2: '封存',
                3: '销户',
              }
              this.PF05A = tempArr.map((item) => {
                item.PF05AD01 = statusDic[item.PF05AD01] ? statusDic[item.PF05AD01] : '--'
                item.PF05AQ02 += '%'
                item.PF05AQ03 += '%'
                return item
              })
            } else this.PF05A = []
            if (this.allData.POT?.PF01?.PF01A) {
              let tempArr = Array.isArray(this.allData.POT?.PF01?.PF01A) ? this.allData.POT?.PF01?.PF01A : [this.allData.POT?.PF01?.PF01A]
              this.PF01A = tempArr.map((item) => {
                return item
              })
            } else this.PF01A = []
            if (this.allData.PCJ?.PF02?.PF02A) {
              let tempArr = Array.isArray(this.allData.PCJ?.PF02?.PF02A) ? this.allData.PCJ?.PF02?.PF02A : [this.allData.PCJ?.PF02?.PF02A]
              this.PF02A = tempArr.map((item) => {
                return item
              })
            } else this.PF02A = []
            if (this.allData.PCE?.PF03?.PF03A) {
              let tempArr = Array.isArray(this.allData.PCE?.PF03?.PF03A) ? this.allData.PCE?.PF03?.PF03A : [this.allData.PCE?.PF03?.PF03A]
              this.PF03A = tempArr.map((item) => {
                return item
              })
            } else this.PF03A = []
            if (this.allData.PAP?.PF04?.PF04A) {
              let tempArr = Array.isArray(this.allData.PAP?.PF04?.PF04A) ? this.allData.PAP?.PF04?.PF04A : [this.allData.PAP?.PF04?.PF04A]
              this.PF04A = tempArr.map((item) => {
                return item
              })
            } else this.PF04A = []
            if (this.allData.PBS?.PF06?.PF06A) {
              let tempArr = Array.isArray(this.allData.PBS?.PF06?.PF06A) ? this.allData.PBS?.PF06?.PF06A : [this.allData.PBS?.PF06?.PF06A]
              this.PF06A = tempArr.map((item) => {
                return item
              })
            } else this.PF06A = []
            if (this.allData.PPQ?.PF07?.PF07A) {
              let tempArr = Array.isArray(this.allData.PPQ?.PF07?.PF07A) ? this.allData.PPQ?.PF07?.PF07A : [this.allData.PPQ?.PF07?.PF07A]
              this.PF07A = tempArr.map((item) => {
                return item
              })
            } else this.PF07A = []
            if (this.allData.PAH?.PF08?.PF08A) {
              let tempArr = Array.isArray(this.allData.PAH?.PF08?.PF08A) ? this.allData.PAH?.PF08?.PF08A : [this.allData.PAH?.PF08?.PF08A]
              this.PF08A = tempArr.map((item) => {
                return item
              })
            } else this.PF08A = []
            if (this.allData.PND?.PE01?.PE01A) {
              let tempArr = Array.isArray(this.allData.PND?.PE01?.PE01A) ? this.allData.PND?.PE01?.PE01A : [this.allData.PND?.PE01?.PE01A]
              this.PE01A = tempArr.map((item) => {
                return item
              })
            } else this.PE01A = []
          } else if (res.is_success == 2) {
            this.dialogVisible = false
            this.$message({
              message: '该用户没有查询到征信信息',
              type: 'error',
            })
          } else if (res.is_success == 3) {
            this.dialogVisible = false
            this.$message({
              message: '征信查询成功！正在生成征信数据，请耐心等候1-3分钟再次查询数据！',
              type: 'success',
            })
          }
        })
        .catch((e) => {
          console.log('查看征信失败--', e)

          this.closeDialog()
          return this.$message.error('查看征信失败！')
        })
        .finally(() => {
          loading.close()
        })
    },
    creditDataHandler(originData) {
      let result
      let type = Object.prototype.toString.call(originData).replace(/\[object (\w+)\]/, '$1')
      if (type === 'Object') {
        result = {}
      } else if (type === 'Array') {
        result = []
      } else {
        return originData
      }
      for (const key in originData) {
        let t = Object.prototype.toString.call(originData[key]).replace(/\[object (\w+)\]/, '$1')
        if (t === 'Object' || t === 'Array') {
          if (!Object.keys(originData[key]).length) {
            result[key] = '--'
          } else {
            result[key] = this.creditDataHandler(originData[key])
          }
        } else {
          result[key] = originData[key]
        }
      }
      return result
    },
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        this.getData()
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.type_tip {
  color: #999999;
  line-height: 22px;

  span {
    color: #ff4146;
  }
}

.sx-box {
  margin: 20px 0;
  color: #606266;

  .account-sx {
    justify-content: space-between;
    height: 40px;
    line-height: 40px;
  }
}

.ggmx-box {
  margin-bottom: 40px;
}

.ggmx-title {
  text-align: center;
  font-size: 20px;
  background-color: #fafafa;
}

.account {
  justify-content: space-between;
  border: 1px solid #ebeef5;
  height: 40px;
  line-height: 40px;
}

.account p {
  border-left: 1px solid #ebeef5;

  &:first-child {
    border-left: none;
  }
}

.textoverflow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>
